package com.demo.hello.annotation;

import com.demo.hello.decoupling.HelloWorldMessageProvider;
import com.demo.hello.decoupling.MessageProvider;
import com.demo.hello.decoupling.MessageRenderer;
import com.demo.hello.decoupling.StandardOutMessageRender;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 描述：
 *
 * @author lida
 * @time 2019/10/11 10:27
 */
//@ComponentScan("com.demo.hello.annotation")
@Configuration
public class HelloWorldConfiguration {
	//生成一个HelloWorldMessageProvider
	@Bean("p")
	public MessageProvider provider(){
		return new HelloWorldMessageProvider();
	}

	@Bean
	public MessageRenderer renderer(){
		MessageRenderer mr = new StandardOutMessageRender();
		mr.setMessageProvider(provider());
		return mr;
	}
}
